home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWPart / Sources / FWClnInf.cpp < prev    next >
Encoding:
Text File  |  1995-11-08  |  4.3 KB  |  156 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWClnInf.cpp
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "FWFrameW.hpp"
  11.  
  12. #ifndef FWCLNINF_H
  13. #include "FWClnInf.h"
  14. #endif
  15.  
  16. #ifndef FWFRAME_H
  17. #include "FWFrame.h"
  18. #endif
  19.  
  20. // ----- OpenDoc Includes -----
  21.  
  22. #ifndef SOM_ODDraft_xh
  23. #include <Draft.xh>
  24. #endif
  25.  
  26. #ifndef SOM_ODShape_xh
  27. #include <Shape.xh>
  28. #endif
  29.  
  30. //========================================================================================
  31. //    Runtime Info
  32. //========================================================================================
  33.  
  34. #if FW_LIB_EXPORT_PRAGMAS
  35. #pragma lib_export on
  36. #endif
  37.  
  38. #ifdef FW_BUILD_MAC
  39. #pragma segment fw_embedding
  40. #endif
  41.  
  42. //========================================================================================
  43. //    struct FW_CCloneInfo
  44. //========================================================================================
  45.  
  46. //----------------------------------------------------------------------------------------
  47. //    FW_CCloneInfo::FW_CCloneInfo
  48. //----------------------------------------------------------------------------------------
  49.  
  50. FW_CCloneInfo::FW_CCloneInfo(Environment* ev, ODDraft* fromDraft, FW_CFrame* scopeFrame, ODCloneKind cloneKind):
  51.     fKey(0),
  52.     fFromDraft(fromDraft),
  53.     fScopeFrame(scopeFrame),
  54.     fCloning(FALSE),
  55.     fBeganClone(FALSE),
  56.     fCloneKind(cloneKind),
  57.     fClonedProxyList(NULL),
  58.     fClonedPartID(kODNULLID),
  59.     fClonedFrameID(kODNULLID),
  60.     fFrameShape(NULL)
  61. {
  62.     FW_END_CONSTRUCTOR
  63. }
  64.  
  65. //----------------------------------------------------------------------------------------
  66. //    FW_CCloneInfo::FW_CCloneInfo
  67. //----------------------------------------------------------------------------------------
  68.  
  69. FW_CCloneInfo::FW_CCloneInfo(Environment* ev, ODDraftKey key, ODDraft* fromDraft, FW_CFrame* scopeFrame, ODCloneKind cloneKind):
  70.     fKey(key),
  71.     fFromDraft(fromDraft),
  72.     fScopeFrame(scopeFrame),
  73.     fCloning(TRUE),
  74.     fBeganClone(FALSE),
  75.     fCloneKind(cloneKind),
  76.     fClonedProxyList(NULL),
  77.     fClonedPartID(kODNULLID),
  78.     fClonedFrameID(kODNULLID),
  79.     fFrameShape(NULL)
  80. {
  81.     FW_END_CONSTRUCTOR
  82. }
  83.  
  84. //----------------------------------------------------------------------------------------
  85. //    FW_CCloneInfo::~FW_CCloneInfo
  86. //----------------------------------------------------------------------------------------
  87.  
  88. FW_CCloneInfo::~FW_CCloneInfo()
  89. {
  90.     FW_START_DESTRUCTOR
  91.     
  92.     Environment* ev = somGetGlobalEnvironment();
  93.     
  94.     if (fCloning && fBeganClone)
  95.         fFromDraft->AbortClone(ev, fKey);
  96.  
  97.     if (fFrameShape)
  98.         fFrameShape->Release(ev);
  99.         
  100.     if (fClonedProxyList)
  101.     {
  102.         delete fClonedProxyList;    // will call remove all
  103.         fClonedProxyList = NULL;
  104.     }    
  105. }
  106.  
  107. //----------------------------------------------------------------------------------------
  108. //    FW_CCloneInfo::BeginClone
  109. //----------------------------------------------------------------------------------------
  110.  
  111. void FW_CCloneInfo::BeginClone(Environment* ev, ODDraft* destinationDraft)
  112. {
  113.     FW_ASSERT(!fCloning);
  114.     fKey = fFromDraft->BeginClone(ev, destinationDraft, fScopeFrame->GetODFrame(ev), fCloneKind);
  115.     fCloning = TRUE;
  116.     fBeganClone = TRUE;
  117. }
  118.  
  119. //----------------------------------------------------------------------------------------
  120. //    FW_CCloneInfo::EndClone
  121. //----------------------------------------------------------------------------------------
  122.  
  123. void FW_CCloneInfo::EndClone(Environment* ev)
  124. {
  125.     FW_ASSERT(fCloning);
  126.     FW_ASSERT(fBeganClone);
  127.     
  128.     fFromDraft->EndClone(ev, fKey);
  129.     fCloning = FALSE;
  130. }
  131.  
  132. //----------------------------------------------------------------------------------------
  133. //    FW_CCloneInfo::AbortClone
  134. //----------------------------------------------------------------------------------------
  135.  
  136. void FW_CCloneInfo::AbortClone(Environment* ev)
  137. {
  138.     FW_ASSERT(fCloning);
  139.     FW_ASSERT(fBeganClone);
  140.  
  141.     fFromDraft->AbortClone(ev, fKey);
  142.     fCloning = FALSE;
  143. }
  144.  
  145. //----------------------------------------------------------------------------------------
  146. //    FW_CCloneInfo::Clone
  147. //----------------------------------------------------------------------------------------
  148.  
  149. ODID FW_CCloneInfo::Clone(Environment* ev, ODID fromObjectID, ODID toObjectID, ODID scope)
  150. {
  151.     FW_ASSERT(fCloning);
  152.  
  153.     return fFromDraft->Clone(ev, fKey, fromObjectID, toObjectID, scope);
  154. }
  155.  
  156.